import { ref, computed,reactive } from 'vue'
import { defineStore } from 'pinia'

export const ThematicStore = defineStore('Thematic', ()=>{
    let thematicInfo = <any>reactive([
    //     {
    //     id:"",
    //     thematic_name:"",
    //     thematic_description:"",
    //     thematic_img:"",
    //     is_shelves:"",
    //     create_time:"",
    //     publish_time:"",
    //     participant_num:"",
    //     category_id:"",
    //     teacher_id:"",
    // }
    ]);
    let partthematicInfo = <any>reactive([
        //     {
        //     id:"",
        //     thematic_name:"",
        //     thematic_description:"",
        //     thematic_img:"",
        //     is_shelves:"",
        //     create_time:"",
        //     publish_time:"",
        //     participant_num:"",
        //     category_id:"",
        //     teacher_id:"",
        // }
    ]);
    let nowthematicInfo = <any>reactive([

    ])
    let nowdatilthematicInfo = <any>reactive([

    ])
    const pageall=<any>ref(0);
    const nowpage=<any>ref(0);
    function delAllDate(){
        thematicInfo=[];
    }
    function pushAllDate(thematic:any){
        pageall.value=0;
        thematicInfo.length=0
        thematic.forEach((item:any) => {
            thematicInfo.push(item);
            pageall.value++;
            
            // console.log(thematicInfo.thematic_name);
        })
    }
    function delPartDate(){
        partthematicInfo=[];
    }
    function pushPartDate(thematic:any){
        // partthematicInfo=thematic
        // partthematicInfo.length=0;
        
        partthematicInfo.splice(0,partthematicInfo.length);
        thematic.forEach((item:any) => {
            partthematicInfo.push(item);
            
            // console.log(thematicInfo.thematic_name);
        })
    }
    function pushIdDate(thematic:any){
        // partthematicInfo=thematic
        // partthematicInfo.length=0;
        nowdatilthematicInfo.length=0
        // partthematicInfo.splice(0,partthematicInfo.length);
        nowdatilthematicInfo.push(thematic);
    }
    function pushNowDate(thematic:any){
        nowthematicInfo.length=0
        nowthematicInfo.push(thematic);
    }
    

    return{thematicInfo,pushAllDate,delAllDate,partthematicInfo,pushPartDate,delPartDate,pageall,nowpage,pushIdDate,nowthematicInfo,pushNowDate,nowdatilthematicInfo}
})